/*
* $Id: QueenBeeManager.h 153 2010-09-26 17:33:07Z volok-aleksej@yandex.ru $
*
* Copyright 2010 by Volokitin Alexey
* All rights reserved
*
*/
#ifndef _QUEEN_BEE_MANAGER_H_
#define _QUEEN_BEE_MANAGER_H_

#include "Components/Journal/JournalInterface.h"

class CQueenBeeManager
{
public:
	struct queen_bee{
		std::tstring s_strName;
		std::tstring s_strDescription;
		std::tstring s_strFert;
		int s_nIdParentQueenBee;
		int s_nIdFamily;
		time_t s_date;
		bool s_bDead;
		QueenBee::breed s_nBreed;
		queen_bee()
			: s_nBreed(QueenBee::HYBRID), s_nIdFamily(0), s_bDead(false), s_nIdParentQueenBee(0), s_date(0){};
		queen_bee(const queen_bee& qb){
			*this = qb;
		}
		void operator = (const queen_bee& qb){
			s_strName = qb.s_strName;
			s_strDescription = qb.s_strDescription;
			s_strFert = qb.s_strFert;
			s_nIdParentQueenBee = qb.s_nIdParentQueenBee;
			s_nIdFamily = qb.s_nIdFamily;
			s_date = qb.s_date;
			s_bDead = qb.s_bDead;
			s_nBreed = qb.s_nBreed;
		}
	};
protected:
	std::map<int, queen_bee> m_aQueenBee;
	std::map<int, std::vector<int> > m_aFamilyQB;
	std::map<TCHAR, std::vector<int> > m_aFilter;
	std::map<int, std::vector<int> > m_aChildQB;
public:
	CQueenBeeManager();
	~CQueenBeeManager();
public:
	void Init();
	int AddQueenBee(const std::tstring& strName, const std::tstring strDescription,
		const std::tstring& strFert, time_t date, bool bDead, QueenBee::breed nBread, int nIdFamily = 0);
	void ChangeQueenBee(int nId, const std::tstring& strName, const std::tstring strDescription,
		const std::tstring& strFert, time_t date, bool bDead, QueenBee::breed nBread);
	void DeleteQueenBee(int nId);
	std::map<int, CQueenBeeManager::queen_bee> GetFamilyQB(int nIdFamily);
	std::map<int, CQueenBeeManager::queen_bee> GetQueenBees();
	std::map<int, CQueenBeeManager::queen_bee> GetChildQB(int nId);
	CQueenBeeManager::queen_bee GetQueenBee(int nId);
	int FindQueenBee(const std::tstring& strName);
	void ChangeFamilyQB(int nId, int nIdFamily);
	void ChangeParentQB(int nId, int nIdParent);
	void DeleteFamilyQB(int nId);
};

#endif/*_QUEEN_BEE_MANAGER_H_*/

